/* 
 * -----------------------------------------------------------------
 * This is sound class for android that extends the sound interface.
 * 2011, by Wu Mu Xian
 * ----------------------------------------------------------------- 
*/

package mygame.myandroidgameframework;

import android.media.SoundPool;

import mygame.basicgameframework.Sound;

public class MyAndroidSound implements Sound{

	int soundId; // the id of sound
	SoundPool soundPool; // the sound pool
	
	// constructor
	public MyAndroidSound(SoundPool soundPool, int soundId) {
		this.soundId = soundId;
		this.soundPool = soundPool;
	}
	
	// play the sound
	public void play(float volume) {
		soundPool.play(soundId, volume, volume, 0, 0, 1);
	}

	// dispose the sound
	public void dispose() {
		soundPool.unload(soundId);	
	}
}
